package com.ltx.blog_ltx.entity.dto;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Rank implements Comparable<Rank>{
    private int userId;
    private String userName;
    private String userHead;
    private int submitNum;
    private int successesNum;
    private String successRate;

    @Override
    public int compareTo(Rank o) {
        int i = o.getSubmitNum() - this.getSubmitNum();//先按照提交次数排序
        if(i == 0){
            return o.successesNum - this.getSuccessesNum();//如果提交次数相等了就按照成功率排序
        }
        return i;
    }
}
